import { useStore } from '@/store';

type handlerName = 'create' | 'update' | 'delete' | 'query';
export const usePermission = function (
  pageName: string,
  handlerName: handlerName
) {
  const store = useStore();
  const permissions = store.state.login.permissions;
  const verfindPermission = `system:${pageName}:${handlerName}`;
  return !!permissions.find((item) => item === verfindPermission);
};
